<!DOCTYPE html>
<!--[if IE 7 ]><html class="ie ie7 lte7 lte8 lte9" lang="en-US"> <![endif]-->
<!--[if IE 8 ]><html class="ie ie8 lte8 lte9" lang="en-US"> <![endif]-->
<!--[if IE 9 ]><html class="ie ie9 lte9>" lang="en-US"> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!-->
<html lang="zh-CN">
<!--<![endif]-->
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>登录 - 美容院销售业绩管理系统</title>
<link href="css/reset.css" rel="stylesheet" type="text/css" media="all" />
<link href="css/reset.css" rel="stylesheet" type="text/css" media="all" />
<link href="css/jquery-ui.min.css" rel="stylesheet" type="text/css"
	media="all" />
<link href="css/main.css" rel="stylesheet" type="text/css" media="all" />
<link href="components/mmGrid/mmGrid.css" rel="stylesheet"
	type="text/css" media="all" />
<link href="components/mmGrid/mmPaginator.css" rel="stylesheet"
	type="text/css" media="all" />
<script type="text/javascript" src="js/jquery-1.11.1.min.js"></script>
<script type="text/javascript" src="js/jquery-ui.min.js"></script>
<script type="text/javascript" src="components/mmGrid/mmGrid.js"></script>
<script type="text/javascript" src="components/mmGrid/mmPaginator.js"></script>
<style type="text/css" media="all">
.STYLE1 {
	color: #FFFFFF;
	font-family: "宋体";
	font-size: 40px;
	font-weight: bold;
	left: 420px;
	top: 100px;
}

.STYLE2 {
	font-size: 16px
}
</style>
</head>
<body>

	<div class="yx-main">
		<form method="post">
			<table width="100%" border="0">
				<tr>
					<td height="160" align="center" valign="middle" bgcolor="#0080FF"><div
							align="center" class="STYLE1">


							<p>&nbsp;</p>
							<p>美容院销售业绩管理系统</p>
						</div></td>
				</tr>
				<tr>
					<td height="160"><dl class="yx-login-panel">

							<dt class="STYLE2">账号登录</dt>
							<dd>
								<label for="userName">用户名</label> <input type="text"
									id="userName" name="userName" maxlength="32"
									class="yx-text yx-username" placeholder="请输入用户名" />
							</dd>
							<dd>
								<label for="password">密 码</label>&nbsp;&nbsp; <input type="password"
									id="password" name="password" maxlength="32"
									class="yx-text yx-password" placeholder="请输入密码" />
							</dd>
							<dd>
								<label> </label> <input type="button" id="submit" value="登 录"
									class="yx-button" />
							</dd>
						</dl></td>
				</tr>
			</table>


		</form>
	</div>
	<div class="yx-copyright">&copy; 2015 版权所有</div>
	<div id="dialog" title="提示" class="yx-hide">
		<div class="yx-dialog-box">
			<p id="dialog-msg">请输入用户名！</p>
		</div>
	</div>

	<script type="text/javascript">
		jQuery(function($) {
			var $dialog = $("#dialog");
			var $dialogMsg = $("#dialog-msg");
			var $userName = $("#userName");
			var $password = $("#password");
			$userName.focus();
			$("#submit").on("click", function(e) {
				if (!$userName.val()) {
					$dialogMsg.text("请输入用户名!");
					$dialog.dialog({
						modal : true,
						buttons : [ {
							text : "确定",
							click : function() {
								$(this).dialog("close");
							}
						} ],
						close : function() {
							$userName.focus();
						}
					});
					return false;
				}
				if (!$password.val()) {
					$dialogMsg.text("请输入密码！");
					$dialog.dialog({
						"modal" : true,
						"buttons" : [ {
							"text" : "确定",
							"click" : function() {
								$(this).dialog("close");
							}
						} ],
						"close" : function() {
							$password.focus();
						}
					});
					return false;
				}
				$.get("user/login", {
					username : $userName.val(),
					password : $password.val()
				}, function(json) {
					if (!json) {
						$dialogMsg.html("用户名或密码错误！<br/><br/>请重新输入");
						$dialog.dialog({
							"modal" : true,
							"buttons" : [ {
								"text" : "确定",
								"click" : function() {
									$(this).dialog("close");
								}
							} ],
							"close" : function() {
								$userName.focus();
							}
						});
					} else {
						window.location = "main.html";
					}
				});
			});
		});

	</script>
</body>
</html>